Socket
Socket
Sign inDemoInstall

pug-load

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pug-load

The Pug loader is responsible for loading the depenendencies of a given Pug file.


Version published
Weekly downloads
1.5M
decreased by-0.49%
Maintainers
2
Weekly downloads
 
Created

What is pug-load?

The pug-load package is a utility for loading and resolving Pug templates. It is typically used internally by the Pug templating engine to handle the loading of templates, including resolving includes and extends statements.

What are pug-load's main functionalities?

Load a Pug template

This feature allows you to load a Pug template from a specified file path. The `loadFile` function reads the Pug file and returns its content.

const pugLoad = require('pug-load');
const template = pugLoad.loadFile('path/to/template.pug');

Resolve includes and extends

This feature resolves the path of an included or extended Pug template. The `resolve` function takes the path of the included template and options, and returns the resolved path.

const pugLoad = require('pug-load');
const options = { filename: 'path/to/template.pug' };
const resolvedTemplate = pugLoad.resolve('include.pug', options);

Compile a Pug template

This feature allows you to compile a loaded Pug template into a render function. The `compile` function from the Pug package is used to compile the template, and the resulting function can be called with data to generate HTML.

const pugLoad = require('pug-load');
const pug = require('pug');
const template = pugLoad.loadFile('path/to/template.pug');
const compiledFunction = pug.compile(template);
const html = compiledFunction({ name: 'World' });

Other packages similar to pug-load

Keywords

FAQs

Package last updated on 25 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc